import typescript from "@rollup/plugin-typescript";
import terser from "@rollup/plugin-terser";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import clear from "rollup-plugin-clear";

import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";

export default {
  input: "src/index.ts",
  output: [
    {
      file: "dist/index.esm.js",
      format: "esm",
    },
    {
      file: "dist/index.umd.js",
      format: "umd",
      name: "TzFlow",
      interop: "auto",
    },
    {
      file: "dist/index.iife.js",
      format: "iife",
      name: "TzFlow",
      interop: "auto",
    },
    {
      file: "dist/index.cjs.js",
      format: "cjs",
    },
  ],
  plugins: [
    clear({ targets: ["dist"] }),
    typescript(),
    resolve(),
    commonjs(),
    terser(),
    serve({
        open: false,
        contentBase: './',
        port: 3000,
    }),
    livereload({
        watch: ['./dist'],
    }),
  ],
};
